#include <iostream>

using namespace std;

const int N = 25;

long long f[N];
int n;

int main()
{
	int n; cin >> n;
	f[2] = 1;
	for(int i = 3; i <= n; i++)
	{
		f[i] = (i - 1) * (f[i - 1] + f[i - 2]);
	}
	cout << f[n] << endl;
	return 0;
} 
